home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Environ.pxl < prev    next >
Text File  |  2000-03-20  |  3KB  |  126 lines

  1. Initialize: {only one instance allowed}
  2.     UseCoordinates(PIXEL)
  3.     Title$ = "PiXCL Environment Block Commands"                                  
  4.     WinExist(Title$,Res)
  5.     If Res = 0 Then Goto One_Instance
  6.     Beep
  7.     WinSetActive(Title$,Res)
  8.     WinShow(Title$,RESTORE,Res)
  9.     End
  10. One_Instance:
  11.     UseCaption(Title$) {change the title}
  12.     WinLocate(Title$,288,154,746,420,Res)                
  13.     UseBackground(TRANSPARENT,0,255,255)     
  14.     WinShow(Title$,NOTOPMOST,Res) 
  15.     DrawBackGround
  16.     DirGet(SourceDir$) {used later for library function calls}
  17.  
  18.     InfoMenu(REMOVE)
  19.     WaitInput(100)
  20.     SetMenu("&File",IGNORE,
  21.         "&New",CreatingFile,
  22.         "&Open",OpeningFile,
  23.         "&Save",SavingFile,
  24.         SEPARATOR,
  25.         "E&xit!",Terminate,
  26.         ENDPOPUP,
  27.         "&Information",IGNORE,
  28.         "&Concept",Concept,
  29.         "&Help",ShowAppHelp,
  30.         SEPARATOR,
  31.         "About",About,
  32.         ENDPOPUP)
  33.  
  34.     GoSub Make_Toolbar        
  35.  
  36.     Offset = 2
  37.     
  38. Wait_for_Input:
  39.     WaitInput()
  40.  
  41. Terminate:
  42.     TMP$ = SourceDir$ + "\*.TMP"
  43.     FileDelete(TMP$,Res)
  44.     End
  45.  
  46.  
  47. Concept:
  48.     MessageBox(OK,1,INFORMATION,
  49. "A Windows application can access and make use of the environment 
  50. block variables. These are copied to each process from the commands
  51. listed originally in the CONFIG.SYS file, and stored by Windows.
  52.  
  53. There are PiXCL commands to read and write the local environment 
  54. block, and to list the currently defined variables.",
  55.     "PiXCL Environment Block Commands",Res)
  56.  
  57.     Goto Wait_for_Input
  58.  
  59. ShowAppHelp:
  60.     {An application Help file usually has the same name as the application.}
  61.     Winhelp("test.hlp",CONTENTS,"")
  62.  
  63.     Goto Wait_for_Input
  64.  
  65. About:
  66.     AboutUser("PiXCL Environment Block Commands",
  67.       "Demonstrate the available commands.","")
  68.     Goto Wait_for_Input
  69.  
  70. CreatingFile:
  71.     DrawBackground
  72.     SetEnvVariable("VAR01","blah 001",Res)
  73.     SetEnvVariable("VAR02","blah 002",Res)
  74.     SetEnvVariable("VAR03","blah 003",Res)
  75.  
  76.     Chr(13,CR$)
  77.     GetEnvString(CR$,Env$)
  78.     MessageBox(OK,1,INFORMATION,Env$,"Environment Block Strings",Res)
  79.     DrawTextExt(0,30,800,500,Env$,LEFT)
  80.  
  81.     Goto Wait_for_Input
  82.  
  83. OpeningFile:
  84.     UseFont("Arial",9,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  85.     DrawBackground
  86.     FileGetTempName(SourceDir$,"pixcl",0,TempFile$)
  87.     DrawText(10,30,TempFile$)
  88.     FileGetTempName(SourceDir$,"pixcl",2,TempFile$)
  89.     DrawText(10,50,TempFile$)
  90.  
  91.     GetTempPath(TempPath$)
  92.     TempPath$ = "TempPath = " + TempPath$
  93.     DrawText(10,70,TempPath$)
  94.  
  95.     GetFontFace(Face$)
  96.     Face$ = "Current Font Face = " + Face$
  97.     DrawText(10,90,Face$)
  98.  
  99.     GetEnvVariable("TMP",TMP$)
  100.     TMP$ = "TMP = " + TMP$
  101.     DrawText(10,110,TMP$)
  102.     
  103.     GetEnvVariable("TEMP",TEMP$)
  104.     TEMP$ = "TEMP = " + TEMP$
  105.     DrawText(10,130,TEMP$)
  106.     
  107.     Goto Wait_for_Input
  108.  
  109. SavingFile:
  110.     MessageBox(OK,1,EXCLAMATION,"Look at source code label 'SavingFile'","No function coded for this button",Res)
  111.     Goto Wait_for_Input
  112.  
  113. AcceptFile:
  114.     GetDragList(FileList$)
  115.     {TODO: add file list handling here, or delete this whole label handler}
  116.     Goto Wait_for_Input
  117.     
  118. Make_Toolbar:
  119.     Toolbar(RAISED, PXL_SMALL,
  120.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  121.         PXL_NEW, ENABLED, STD, "Set some Environment variables", CreatingFile,
  122.         PXL_OPEN, ENABLED, STD, "Show Environment variables", OpeningFile,
  123.         PXL_SAVE, ENABLED, STD, "FileSave", SavingFile,
  124.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  125.         PXL_SHOHLP, ENABLED, STD,"Show Help",ShowAppHelp)
  126.     Return